#ifndef BOARD_H
#define BOARD_H

#include <QWidget>

#include "stone.h"
#include "step.h"


class Board : public QWidget
{
    Q_OBJECT
public:
    explicit Board(QWidget *parent = 0);

    ~Board();

    //
    Stone board_stones[32];//棋盘上的32颗棋子
    int stone_radius;//棋子半径

    int move_id;//移动的棋子
    bool move_side;

    void paintEvent(QPaintEvent *);

    QPoint point(int x, int y);
    QPoint point(int id);

    //void board_init();
    void draw_stone(QPainter &stone_painter, int draw_id);

    void mouseReleaseEvent(QMouseEvent *me);

    bool point_xy(QPoint p,int &x, int &y);
    int xy_id(int x, int y);


    int line_stone(int x, int y);

    bool jiang_move(int x, int y);
    bool che_move(int x, int y);
    bool ma_move(int x, int y);
    bool pao_move(int x, int y);
    bool shi_move(int x, int y);
    bool xiang_move(int x, int y);
    bool zu_move(int x, int y);

    bool can_move(int x, int y);

    void stone_move(int x, int y, int id);

    //虚函数
    virtual void player_move(QPoint p);


    void save_step(int move_id, int kill_id, int from_x, int from_y, int to_x, int to_y, QVector<Step *> &steps);

    void win_fail();







signals:

public slots:
};

#endif // BOARD_H
